package com.hxh.wechat;

import java.io.IOException;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

public class Http {
    public static void main(String[] args) {

        String url = "http://localhost:8888/wh_sys/user/registerOrLogin";
        OkHttpClient okHttpClient = new OkHttpClient();
        FormBody formBody = new FormBody.Builder()
                .add("username", "adawdawda").build();
        Request request = new Request.Builder()
                .url(url)
                .post(formBody)
                .build();
        Call call = okHttpClient.newCall(request);
        call.enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {
                System.out.println("123");
            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                String str = response.body().string();

                System.out.println(str);
            }
        });
    }
}
